﻿// 1020 月饼.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct cake {
    int money;//总金额
    int amount;//数量
    double price;//单价
};

bool cmp(cake a, cake b) {
    return a.price > b.price;
}
int amount[1010];
int money[1010];

int main()
{
    int n, d;//n种月饼，d需求量
    cin >> n >> d;
    
    //先存储库存量，然后存储总售价
    int thismoney, thisamount;
    for (int i = 0; i < n; i++) {
        cin >>  thisamount;
        amount[i] = thisamount;
    }
    for (int i = 0; i < n; i++) {
        cin >> thismoney;
        money[i] = thismoney;
    }
    //封装到vector容器中
    vector<cake> v;
    for (int i = 0; i < n; i++) {
        cake c;
        c.amount = amount[i];
        c.money = money[i];
        c.price = (double)money[i] / amount[i];
        v.push_back(c);
    }
    sort(v.begin(),v.end(),cmp);
    double earn = 0.0;
    int i = 0;
    while (d > 0) {
        if (v[i].amount > d) {
            earn += v[i].price * d;
            d = 0;
        }
        else {
            earn += v[i].money;
            d -= v[i].amount;
        }
        i++;
    }
    printf("%.2f",earn);
    return 0;
}